<?php
if (session_id() == "") session_start(); // Initialize Session data
ob_start(); // Turn on output buffering
?>
<?php include_once "ewcfg10.php" ?>
<?php include_once "ewmysql10.php" ?>
<?php include_once "phpfn10.php" ?>
<?php include_once "rrhh_turnosinfo.php" ?>
<?php include_once "usuariosinfo.php" ?>
<?php include_once "rrhh_turnos_x_personagridcls.php" ?>
<?php include_once "userfn10.php" ?>
<?php

//
// Page class
//

$rrhh_turnos_edit = NULL; // Initialize page object first

class crrhh_turnos_edit extends crrhh_turnos {

	// Page ID
	var $PageID = 'edit';

	// Project ID
	var $ProjectID = "{EE79157A-457E-45C2-815F-74BE5B056823}";

	// Table name
	var $TableName = 'rrhh_turnos';

	// Page object name
	var $PageObjName = 'rrhh_turnos_edit';

	// Page name
	function PageName() {
		return ew_CurrentPage();
	}

	// Page URL
	function PageUrl() {
		$PageUrl = ew_CurrentPage() . "?";
		if ($this->UseTokenInUrl) $PageUrl .= "t=" . $this->TableVar . "&"; // Add page token
		return $PageUrl;
	}

	// Message
	function getMessage() {
		return @$_SESSION[EW_SESSION_MESSAGE];
	}

	function setMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_MESSAGE], $v);
	}

	function getFailureMessage() {
		return @$_SESSION[EW_SESSION_FAILURE_MESSAGE];
	}

	function setFailureMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_FAILURE_MESSAGE], $v);
	}

	function getSuccessMessage() {
		return @$_SESSION[EW_SESSION_SUCCESS_MESSAGE];
	}

	function setSuccessMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_SUCCESS_MESSAGE], $v);
	}

	function getWarningMessage() {
		return @$_SESSION[EW_SESSION_WARNING_MESSAGE];
	}

	function setWarningMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_WARNING_MESSAGE], $v);
	}

	// Show message
	function ShowMessage() {
		$hidden = FALSE;
		$html = "";

		// Message
		$sMessage = $this->getMessage();
		$this->Message_Showing($sMessage, "");
		if ($sMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sMessage;
			$html .= "<div class=\"alert alert-success ewSuccess\">" . $sMessage . "</div>";
			$_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
		}

		// Warning message
		$sWarningMessage = $this->getWarningMessage();
		$this->Message_Showing($sWarningMessage, "warning");
		if ($sWarningMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sWarningMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sWarningMessage;
			$html .= "<div class=\"alert alert-warning ewWarning\">" . $sWarningMessage . "</div>";
			$_SESSION[EW_SESSION_WARNING_MESSAGE] = ""; // Clear message in Session
		}

		// Success message
		$sSuccessMessage = $this->getSuccessMessage();
		$this->Message_Showing($sSuccessMessage, "success");
		if ($sSuccessMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sSuccessMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sSuccessMessage;
			$html .= "<div class=\"alert alert-success ewSuccess\">" . $sSuccessMessage . "</div>";
			$_SESSION[EW_SESSION_SUCCESS_MESSAGE] = ""; // Clear message in Session
		}

		// Failure message
		$sErrorMessage = $this->getFailureMessage();
		$this->Message_Showing($sErrorMessage, "failure");
		if ($sErrorMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sErrorMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sErrorMessage;
			$html .= "<div class=\"alert alert-error ewError\">" . $sErrorMessage . "</div>";
			$_SESSION[EW_SESSION_FAILURE_MESSAGE] = ""; // Clear message in Session
		}
		echo "<table class=\"ewStdTable\"><tr><td><div class=\"ewMessageDialog\"" . (($hidden) ? " style=\"display: none;\"" : "") . ">" . $html . "</div></td></tr></table>";
	}
	var $PageHeader;
	var $PageFooter;

	// Show Page Header
	function ShowPageHeader() {
		$sHeader = $this->PageHeader;
		$this->Page_DataRendering($sHeader);
		if ($sHeader <> "") { // Header exists, display
			echo "<p>" . $sHeader . "</p>";
		}
	}

	// Show Page Footer
	function ShowPageFooter() {
		$sFooter = $this->PageFooter;
		$this->Page_DataRendered($sFooter);
		if ($sFooter <> "") { // Footer exists, display
			echo "<p>" . $sFooter . "</p>";
		}
	}

	// Validate page request
	function IsPageRequest() {
		global $objForm;
		if ($this->UseTokenInUrl) {
			if ($objForm)
				return ($this->TableVar == $objForm->GetValue("t"));
			if (@$_GET["t"] <> "")
				return ($this->TableVar == $_GET["t"]);
		} else {
			return TRUE;
		}
	}

	//
	// Page class constructor
	//
	function __construct() {
		global $conn, $Language;
		$GLOBALS["Page"] = &$this;

		// Language object
		if (!isset($Language)) $Language = new cLanguage();

		// Parent constuctor
		parent::__construct();

		// Table object (rrhh_turnos)
		if (!isset($GLOBALS["rrhh_turnos"]) || get_class($GLOBALS["rrhh_turnos"]) == "crrhh_turnos") {
			$GLOBALS["rrhh_turnos"] = &$this;
			$GLOBALS["Table"] = &$GLOBALS["rrhh_turnos"];
		}

		// Table object (usuarios)
		if (!isset($GLOBALS['usuarios'])) $GLOBALS['usuarios'] = new cusuarios();

		// Page ID
		if (!defined("EW_PAGE_ID"))
			define("EW_PAGE_ID", 'edit', TRUE);

		// Table name (for backward compatibility)
		if (!defined("EW_TABLE_NAME"))
			define("EW_TABLE_NAME", 'rrhh_turnos', TRUE);

		// Start timer
		if (!isset($GLOBALS["gTimer"])) $GLOBALS["gTimer"] = new cTimer();

		// Open connection
		if (!isset($conn)) $conn = ew_Connect();
	}

	// 
	//  Page_Init
	//
	function Page_Init() {
		global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;

		// Security
		$Security = new cAdvancedSecurity();
		if (!$Security->IsLoggedIn()) $Security->AutoLogin();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}

		// Create form object
		$objForm = new cFormObj();
		$this->CurrentAction = (@$_GET["a"] <> "") ? $_GET["a"] : @$_POST["a_list"]; // Set up current action
		$this->TurnoId->Visible = !$this->IsAdd() && !$this->IsCopy() && !$this->IsGridAdd();

		// Global Page Loading event (in userfn*.php)
		Page_Loading();

		// Page Load event
		$this->Page_Load();
	}

	//
	// Page_Terminate
	//
	function Page_Terminate($url = "") {
		global $conn;

		// Page Unload event
		$this->Page_Unload();

		// Global Page Unloaded event (in userfn*.php)
		Page_Unloaded();
		$this->Page_Redirecting($url);

		 // Close connection
		$conn->Close();

		// Go to URL if specified
		if ($url <> "") {
			if (!EW_DEBUG_ENABLED && ob_get_length())
				ob_end_clean();
			header("Location: " . $url);
		}
		exit();
	}
	var $DbMasterFilter;
	var $DbDetailFilter;

	// 
	// Page main
	//
	function Page_Main() {
		global $objForm, $Language, $gsFormError;

		// Load key from QueryString
		if (@$_GET["TurnoId"] <> "") {
			$this->TurnoId->setQueryStringValue($_GET["TurnoId"]);
		}

		// Set up Breadcrumb
		$this->SetupBreadcrumb();

		// Process form if post back
		if (@$_POST["a_edit"] <> "") {
			$this->CurrentAction = $_POST["a_edit"]; // Get action code
			$this->LoadFormValues(); // Get form values

			// Set up detail parameters
			$this->SetUpDetailParms();
		} else {
			$this->CurrentAction = "I"; // Default action is display
		}

		// Check if valid key
		if ($this->TurnoId->CurrentValue == "")
			$this->Page_Terminate("rrhh_turnoslist.php"); // Invalid key, return to list

		// Validate form if post back
		if (@$_POST["a_edit"] <> "") {
			if (!$this->ValidateForm()) {
				$this->CurrentAction = ""; // Form error, reset action
				$this->setFailureMessage($gsFormError);
				$this->EventCancelled = TRUE; // Event cancelled
				$this->RestoreFormValues();
			}
		}
		switch ($this->CurrentAction) {
			case "I": // Get a record to display
				if (!$this->LoadRow()) { // Load record based on key
					if ($this->getFailureMessage() == "") $this->setFailureMessage($Language->Phrase("NoRecord")); // No record found
					$this->Page_Terminate("rrhh_turnoslist.php"); // No matching record, return to list
				}

				// Set up detail parameters
				$this->SetUpDetailParms();
				break;
			Case "U": // Update
				$this->SendEmail = TRUE; // Send email on update success
				if ($this->EditRow()) { // Update record based on key
					if ($this->getSuccessMessage() == "")
						$this->setSuccessMessage($Language->Phrase("UpdateSuccess")); // Update success
					if ($this->getCurrentDetailTable() <> "") // Master/detail edit
						$sReturnUrl = $this->GetDetailUrl();
					else
						$sReturnUrl = $this->getReturnUrl();
					$this->Page_Terminate($sReturnUrl); // Return to caller
				} else {
					$this->EventCancelled = TRUE; // Event cancelled
					$this->RestoreFormValues(); // Restore form values if update failed

					// Set up detail parameters
					$this->SetUpDetailParms();
				}
		}

		// Render the record
		$this->RowType = EW_ROWTYPE_EDIT; // Render as Edit
		$this->ResetAttrs();
		$this->RenderRow();
	}

	// Set up starting record parameters
	function SetUpStartRec() {
		if ($this->DisplayRecs == 0)
			return;
		if ($this->IsPageRequest()) { // Validate request
			if (@$_GET[EW_TABLE_START_REC] <> "") { // Check for "start" parameter
				$this->StartRec = $_GET[EW_TABLE_START_REC];
				$this->setStartRecordNumber($this->StartRec);
			} elseif (@$_GET[EW_TABLE_PAGE_NO] <> "") {
				$PageNo = $_GET[EW_TABLE_PAGE_NO];
				if (is_numeric($PageNo)) {
					$this->StartRec = ($PageNo-1)*$this->DisplayRecs+1;
					if ($this->StartRec <= 0) {
						$this->StartRec = 1;
					} elseif ($this->StartRec >= intval(($this->TotalRecs-1)/$this->DisplayRecs)*$this->DisplayRecs+1) {
						$this->StartRec = intval(($this->TotalRecs-1)/$this->DisplayRecs)*$this->DisplayRecs+1;
					}
					$this->setStartRecordNumber($this->StartRec);
				}
			}
		}
		$this->StartRec = $this->getStartRecordNumber();

		// Check if correct start record counter
		if (!is_numeric($this->StartRec) || $this->StartRec == "") { // Avoid invalid start record counter
			$this->StartRec = 1; // Reset start record counter
			$this->setStartRecordNumber($this->StartRec);
		} elseif (intval($this->StartRec) > intval($this->TotalRecs)) { // Avoid starting record > total records
			$this->StartRec = intval(($this->TotalRecs-1)/$this->DisplayRecs)*$this->DisplayRecs+1; // Point to last page first record
			$this->setStartRecordNumber($this->StartRec);
		} elseif (($this->StartRec-1) % $this->DisplayRecs <> 0) {
			$this->StartRec = intval(($this->StartRec-1)/$this->DisplayRecs)*$this->DisplayRecs+1; // Point to page boundary
			$this->setStartRecordNumber($this->StartRec);
		}
	}

	// Get upload files
	function GetUploadFiles() {
		global $objForm;

		// Get upload data
	}

	// Load form values
	function LoadFormValues() {

		// Load from form
		global $objForm;
		if (!$this->TurnoId->FldIsDetailKey)
			$this->TurnoId->setFormValue($objForm->GetValue("x_TurnoId"));
		if (!$this->TurnoNombre->FldIsDetailKey) {
			$this->TurnoNombre->setFormValue($objForm->GetValue("x_TurnoNombre"));
		}
		if (!$this->TurnoHoraInicio->FldIsDetailKey) {
			$this->TurnoHoraInicio->setFormValue($objForm->GetValue("x_TurnoHoraInicio"));
		}
		if (!$this->TurnoHoraFin->FldIsDetailKey) {
			$this->TurnoHoraFin->setFormValue($objForm->GetValue("x_TurnoHoraFin"));
		}
		if (!$this->TurnoHoraValidaEntradaDesde->FldIsDetailKey) {
			$this->TurnoHoraValidaEntradaDesde->setFormValue($objForm->GetValue("x_TurnoHoraValidaEntradaDesde"));
		}
		if (!$this->TurnoHoraValidaEntradaHasta->FldIsDetailKey) {
			$this->TurnoHoraValidaEntradaHasta->setFormValue($objForm->GetValue("x_TurnoHoraValidaEntradaHasta"));
		}
		if (!$this->TurnoHoraValidaSalidaDesde->FldIsDetailKey) {
			$this->TurnoHoraValidaSalidaDesde->setFormValue($objForm->GetValue("x_TurnoHoraValidaSalidaDesde"));
		}
		if (!$this->TurnoHoraValidaSalidaHasta->FldIsDetailKey) {
			$this->TurnoHoraValidaSalidaHasta->setFormValue($objForm->GetValue("x_TurnoHoraValidaSalidaHasta"));
		}
		if (!$this->TurnoTolMinutosEntrada->FldIsDetailKey) {
			$this->TurnoTolMinutosEntrada->setFormValue($objForm->GetValue("x_TurnoTolMinutosEntrada"));
		}
		if (!$this->TurnoTolMinutosSalida->FldIsDetailKey) {
			$this->TurnoTolMinutosSalida->setFormValue($objForm->GetValue("x_TurnoTolMinutosSalida"));
		}
		if (!$this->TurnoDiasContados->FldIsDetailKey) {
			$this->TurnoDiasContados->setFormValue($objForm->GetValue("x_TurnoDiasContados"));
		}
		if (!$this->TurnoFlexible->FldIsDetailKey) {
			$this->TurnoFlexible->setFormValue($objForm->GetValue("x_TurnoFlexible"));
		}
	}

	// Restore form values
	function RestoreFormValues() {
		global $objForm;
		$this->LoadRow();
		$this->TurnoId->CurrentValue = $this->TurnoId->FormValue;
		$this->TurnoNombre->CurrentValue = $this->TurnoNombre->FormValue;
		$this->TurnoHoraInicio->CurrentValue = $this->TurnoHoraInicio->FormValue;
		$this->TurnoHoraFin->CurrentValue = $this->TurnoHoraFin->FormValue;
		$this->TurnoHoraValidaEntradaDesde->CurrentValue = $this->TurnoHoraValidaEntradaDesde->FormValue;
		$this->TurnoHoraValidaEntradaHasta->CurrentValue = $this->TurnoHoraValidaEntradaHasta->FormValue;
		$this->TurnoHoraValidaSalidaDesde->CurrentValue = $this->TurnoHoraValidaSalidaDesde->FormValue;
		$this->TurnoHoraValidaSalidaHasta->CurrentValue = $this->TurnoHoraValidaSalidaHasta->FormValue;
		$this->TurnoTolMinutosEntrada->CurrentValue = $this->TurnoTolMinutosEntrada->FormValue;
		$this->TurnoTolMinutosSalida->CurrentValue = $this->TurnoTolMinutosSalida->FormValue;
		$this->TurnoDiasContados->CurrentValue = $this->TurnoDiasContados->FormValue;
		$this->TurnoFlexible->CurrentValue = $this->TurnoFlexible->FormValue;
	}

	// Load row based on key values
	function LoadRow() {
		global $conn, $Security, $Language;
		$sFilter = $this->KeyFilter();

		// Call Row Selecting event
		$this->Row_Selecting($sFilter);

		// Load SQL based on filter
		$this->CurrentFilter = $sFilter;
		$sSql = $this->SQL();
		$res = FALSE;
		$rs = ew_LoadRecordset($sSql);
		if ($rs && !$rs->EOF) {
			$res = TRUE;
			$this->LoadRowValues($rs); // Load row values
			$rs->Close();
		}
		return $res;
	}

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn;
		if (!$rs || $rs->EOF) return;

		// Call Row Selected event
		$row = &$rs->fields;
		$this->Row_Selected($row);
		$this->TurnoId->setDbValue($rs->fields('TurnoId'));
		$this->TurnoNombre->setDbValue($rs->fields('TurnoNombre'));
		$this->TurnoHoraInicio->setDbValue($rs->fields('TurnoHoraInicio'));
		$this->TurnoHoraFin->setDbValue($rs->fields('TurnoHoraFin'));
		$this->TurnoHoraValidaEntradaDesde->setDbValue($rs->fields('TurnoHoraValidaEntradaDesde'));
		$this->TurnoHoraValidaEntradaHasta->setDbValue($rs->fields('TurnoHoraValidaEntradaHasta'));
		$this->TurnoHoraValidaSalidaDesde->setDbValue($rs->fields('TurnoHoraValidaSalidaDesde'));
		$this->TurnoHoraValidaSalidaHasta->setDbValue($rs->fields('TurnoHoraValidaSalidaHasta'));
		$this->TurnoTolMinutosEntrada->setDbValue($rs->fields('TurnoTolMinutosEntrada'));
		$this->TurnoTolMinutosSalida->setDbValue($rs->fields('TurnoTolMinutosSalida'));
		$this->TurnoDiasContados->setDbValue($rs->fields('TurnoDiasContados'));
		$this->TurnoFlexible->setDbValue($rs->fields('TurnoFlexible'));
	}

	// Load DbValue from recordset
	function LoadDbValues(&$rs) {
		if (!$rs || !is_array($rs) && $rs->EOF) return;
		$row = is_array($rs) ? $rs : $rs->fields;
		$this->TurnoId->DbValue = $row['TurnoId'];
		$this->TurnoNombre->DbValue = $row['TurnoNombre'];
		$this->TurnoHoraInicio->DbValue = $row['TurnoHoraInicio'];
		$this->TurnoHoraFin->DbValue = $row['TurnoHoraFin'];
		$this->TurnoHoraValidaEntradaDesde->DbValue = $row['TurnoHoraValidaEntradaDesde'];
		$this->TurnoHoraValidaEntradaHasta->DbValue = $row['TurnoHoraValidaEntradaHasta'];
		$this->TurnoHoraValidaSalidaDesde->DbValue = $row['TurnoHoraValidaSalidaDesde'];
		$this->TurnoHoraValidaSalidaHasta->DbValue = $row['TurnoHoraValidaSalidaHasta'];
		$this->TurnoTolMinutosEntrada->DbValue = $row['TurnoTolMinutosEntrada'];
		$this->TurnoTolMinutosSalida->DbValue = $row['TurnoTolMinutosSalida'];
		$this->TurnoDiasContados->DbValue = $row['TurnoDiasContados'];
		$this->TurnoFlexible->DbValue = $row['TurnoFlexible'];
	}

	// Render row values based on field settings
	function RenderRow() {
		global $conn, $Security, $Language;
		global $gsLanguage;

		// Initialize URLs
		// Convert decimal values if posted back

		if ($this->TurnoDiasContados->FormValue == $this->TurnoDiasContados->CurrentValue && is_numeric(ew_StrToFloat($this->TurnoDiasContados->CurrentValue)))
			$this->TurnoDiasContados->CurrentValue = ew_StrToFloat($this->TurnoDiasContados->CurrentValue);

		// Call Row_Rendering event
		$this->Row_Rendering();

		// Common render codes for all row types
		// TurnoId
		// TurnoNombre
		// TurnoHoraInicio
		// TurnoHoraFin
		// TurnoHoraValidaEntradaDesde
		// TurnoHoraValidaEntradaHasta
		// TurnoHoraValidaSalidaDesde
		// TurnoHoraValidaSalidaHasta
		// TurnoTolMinutosEntrada
		// TurnoTolMinutosSalida
		// TurnoDiasContados
		// TurnoFlexible

		if ($this->RowType == EW_ROWTYPE_VIEW) { // View row

			// TurnoId
			$this->TurnoId->ViewValue = $this->TurnoId->CurrentValue;
			$this->TurnoId->ViewCustomAttributes = "";

			// TurnoNombre
			$this->TurnoNombre->ViewValue = $this->TurnoNombre->CurrentValue;
			$this->TurnoNombre->ViewCustomAttributes = "";

			// TurnoHoraInicio
			$this->TurnoHoraInicio->ViewValue = $this->TurnoHoraInicio->CurrentValue;
			$this->TurnoHoraInicio->ViewCustomAttributes = "";

			// TurnoHoraFin
			$this->TurnoHoraFin->ViewValue = $this->TurnoHoraFin->CurrentValue;
			$this->TurnoHoraFin->ViewCustomAttributes = "";

			// TurnoHoraValidaEntradaDesde
			$this->TurnoHoraValidaEntradaDesde->ViewValue = $this->TurnoHoraValidaEntradaDesde->CurrentValue;
			$this->TurnoHoraValidaEntradaDesde->ViewCustomAttributes = "";

			// TurnoHoraValidaEntradaHasta
			$this->TurnoHoraValidaEntradaHasta->ViewValue = $this->TurnoHoraValidaEntradaHasta->CurrentValue;
			$this->TurnoHoraValidaEntradaHasta->ViewCustomAttributes = "";

			// TurnoHoraValidaSalidaDesde
			$this->TurnoHoraValidaSalidaDesde->ViewValue = $this->TurnoHoraValidaSalidaDesde->CurrentValue;
			$this->TurnoHoraValidaSalidaDesde->ViewCustomAttributes = "";

			// TurnoHoraValidaSalidaHasta
			$this->TurnoHoraValidaSalidaHasta->ViewValue = $this->TurnoHoraValidaSalidaHasta->CurrentValue;
			$this->TurnoHoraValidaSalidaHasta->ViewCustomAttributes = "";

			// TurnoTolMinutosEntrada
			$this->TurnoTolMinutosEntrada->ViewValue = $this->TurnoTolMinutosEntrada->CurrentValue;
			$this->TurnoTolMinutosEntrada->ViewCustomAttributes = "";

			// TurnoTolMinutosSalida
			$this->TurnoTolMinutosSalida->ViewValue = $this->TurnoTolMinutosSalida->CurrentValue;
			$this->TurnoTolMinutosSalida->ViewCustomAttributes = "";

			// TurnoDiasContados
			$this->TurnoDiasContados->ViewValue = $this->TurnoDiasContados->CurrentValue;
			$this->TurnoDiasContados->ViewCustomAttributes = "";

			// TurnoFlexible
			if (strval($this->TurnoFlexible->CurrentValue) <> "") {
				switch ($this->TurnoFlexible->CurrentValue) {
					case $this->TurnoFlexible->FldTagValue(1):
						$this->TurnoFlexible->ViewValue = $this->TurnoFlexible->FldTagCaption(1) <> "" ? $this->TurnoFlexible->FldTagCaption(1) : $this->TurnoFlexible->CurrentValue;
						break;
					default:
						$this->TurnoFlexible->ViewValue = $this->TurnoFlexible->CurrentValue;
				}
			} else {
				$this->TurnoFlexible->ViewValue = NULL;
			}
			$this->TurnoFlexible->ViewCustomAttributes = "";

			// TurnoId
			$this->TurnoId->LinkCustomAttributes = "";
			$this->TurnoId->HrefValue = "";
			$this->TurnoId->TooltipValue = "";

			// TurnoNombre
			$this->TurnoNombre->LinkCustomAttributes = "";
			$this->TurnoNombre->HrefValue = "";
			$this->TurnoNombre->TooltipValue = "";

			// TurnoHoraInicio
			$this->TurnoHoraInicio->LinkCustomAttributes = "";
			$this->TurnoHoraInicio->HrefValue = "";
			$this->TurnoHoraInicio->TooltipValue = "";

			// TurnoHoraFin
			$this->TurnoHoraFin->LinkCustomAttributes = "";
			$this->TurnoHoraFin->HrefValue = "";
			$this->TurnoHoraFin->TooltipValue = "";

			// TurnoHoraValidaEntradaDesde
			$this->TurnoHoraValidaEntradaDesde->LinkCustomAttributes = "";
			$this->TurnoHoraValidaEntradaDesde->HrefValue = "";
			$this->TurnoHoraValidaEntradaDesde->TooltipValue = "";

			// TurnoHoraValidaEntradaHasta
			$this->TurnoHoraValidaEntradaHasta->LinkCustomAttributes = "";
			$this->TurnoHoraValidaEntradaHasta->HrefValue = "";
			$this->TurnoHoraValidaEntradaHasta->TooltipValue = "";

			// TurnoHoraValidaSalidaDesde
			$this->TurnoHoraValidaSalidaDesde->LinkCustomAttributes = "";
			$this->TurnoHoraValidaSalidaDesde->HrefValue = "";
			$this->TurnoHoraValidaSalidaDesde->TooltipValue = "";

			// TurnoHoraValidaSalidaHasta
			$this->TurnoHoraValidaSalidaHasta->LinkCustomAttributes = "";
			$this->TurnoHoraValidaSalidaHasta->HrefValue = "";
			$this->TurnoHoraValidaSalidaHasta->TooltipValue = "";

			// TurnoTolMinutosEntrada
			$this->TurnoTolMinutosEntrada->LinkCustomAttributes = "";
			$this->TurnoTolMinutosEntrada->HrefValue = "";
			$this->TurnoTolMinutosEntrada->TooltipValue = "";

			// TurnoTolMinutosSalida
			$this->TurnoTolMinutosSalida->LinkCustomAttributes = "";
			$this->TurnoTolMinutosSalida->HrefValue = "";
			$this->TurnoTolMinutosSalida->TooltipValue = "";

			// TurnoDiasContados
			$this->TurnoDiasContados->LinkCustomAttributes = "";
			$this->TurnoDiasContados->HrefValue = "";
			$this->TurnoDiasContados->TooltipValue = "";

			// TurnoFlexible
			$this->TurnoFlexible->LinkCustomAttributes = "";
			$this->TurnoFlexible->HrefValue = "";
			$this->TurnoFlexible->TooltipValue = "";
		} elseif ($this->RowType == EW_ROWTYPE_EDIT) { // Edit row

			// TurnoId
			$this->TurnoId->EditCustomAttributes = "";
			$this->TurnoId->EditValue = $this->TurnoId->CurrentValue;
			$this->TurnoId->ViewCustomAttributes = "";

			// TurnoNombre
			$this->TurnoNombre->EditCustomAttributes = "";
			$this->TurnoNombre->EditValue = ew_HtmlEncode($this->TurnoNombre->CurrentValue);
			$this->TurnoNombre->PlaceHolder = ew_RemoveHtml($this->TurnoNombre->FldCaption());

			// TurnoHoraInicio
			$this->TurnoHoraInicio->EditCustomAttributes = "";
			$this->TurnoHoraInicio->EditValue = ew_HtmlEncode($this->TurnoHoraInicio->CurrentValue);
			$this->TurnoHoraInicio->PlaceHolder = ew_RemoveHtml($this->TurnoHoraInicio->FldCaption());

			// TurnoHoraFin
			$this->TurnoHoraFin->EditCustomAttributes = "";
			$this->TurnoHoraFin->EditValue = ew_HtmlEncode($this->TurnoHoraFin->CurrentValue);
			$this->TurnoHoraFin->PlaceHolder = ew_RemoveHtml($this->TurnoHoraFin->FldCaption());

			// TurnoHoraValidaEntradaDesde
			$this->TurnoHoraValidaEntradaDesde->EditCustomAttributes = "";
			$this->TurnoHoraValidaEntradaDesde->EditValue = ew_HtmlEncode($this->TurnoHoraValidaEntradaDesde->CurrentValue);
			$this->TurnoHoraValidaEntradaDesde->PlaceHolder = ew_RemoveHtml($this->TurnoHoraValidaEntradaDesde->FldCaption());

			// TurnoHoraValidaEntradaHasta
			$this->TurnoHoraValidaEntradaHasta->EditCustomAttributes = "";
			$this->TurnoHoraValidaEntradaHasta->EditValue = ew_HtmlEncode($this->TurnoHoraValidaEntradaHasta->CurrentValue);
			$this->TurnoHoraValidaEntradaHasta->PlaceHolder = ew_RemoveHtml($this->TurnoHoraValidaEntradaHasta->FldCaption());

			// TurnoHoraValidaSalidaDesde
			$this->TurnoHoraValidaSalidaDesde->EditCustomAttributes = "";
			$this->TurnoHoraValidaSalidaDesde->EditValue = ew_HtmlEncode($this->TurnoHoraValidaSalidaDesde->CurrentValue);
			$this->TurnoHoraValidaSalidaDesde->PlaceHolder = ew_RemoveHtml($this->TurnoHoraValidaSalidaDesde->FldCaption());

			// TurnoHoraValidaSalidaHasta
			$this->TurnoHoraValidaSalidaHasta->EditCustomAttributes = "";
			$this->TurnoHoraValidaSalidaHasta->EditValue = ew_HtmlEncode($this->TurnoHoraValidaSalidaHasta->CurrentValue);
			$this->TurnoHoraValidaSalidaHasta->PlaceHolder = ew_RemoveHtml($this->TurnoHoraValidaSalidaHasta->FldCaption());

			// TurnoTolMinutosEntrada
			$this->TurnoTolMinutosEntrada->EditCustomAttributes = "";
			$this->TurnoTolMinutosEntrada->EditValue = ew_HtmlEncode($this->TurnoTolMinutosEntrada->CurrentValue);
			$this->TurnoTolMinutosEntrada->PlaceHolder = ew_RemoveHtml($this->TurnoTolMinutosEntrada->FldCaption());

			// TurnoTolMinutosSalida
			$this->TurnoTolMinutosSalida->EditCustomAttributes = "";
			$this->TurnoTolMinutosSalida->EditValue = ew_HtmlEncode($this->TurnoTolMinutosSalida->CurrentValue);
			$this->TurnoTolMinutosSalida->PlaceHolder = ew_RemoveHtml($this->TurnoTolMinutosSalida->FldCaption());

			// TurnoDiasContados
			$this->TurnoDiasContados->EditCustomAttributes = "";
			$this->TurnoDiasContados->EditValue = ew_HtmlEncode($this->TurnoDiasContados->CurrentValue);
			$this->TurnoDiasContados->PlaceHolder = ew_RemoveHtml($this->TurnoDiasContados->FldCaption());
			if (strval($this->TurnoDiasContados->EditValue) <> "" && is_numeric($this->TurnoDiasContados->EditValue)) $this->TurnoDiasContados->EditValue = ew_FormatNumber($this->TurnoDiasContados->EditValue, -2, -1, -2, 0);

			// TurnoFlexible
			$this->TurnoFlexible->EditCustomAttributes = "";
			$arwrk = array();
			$arwrk[] = array($this->TurnoFlexible->FldTagValue(1), $this->TurnoFlexible->FldTagCaption(1) <> "" ? $this->TurnoFlexible->FldTagCaption(1) : $this->TurnoFlexible->FldTagValue(1));
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect")));
			$this->TurnoFlexible->EditValue = $arwrk;

			// Edit refer script
			// TurnoId

			$this->TurnoId->HrefValue = "";

			// TurnoNombre
			$this->TurnoNombre->HrefValue = "";

			// TurnoHoraInicio
			$this->TurnoHoraInicio->HrefValue = "";

			// TurnoHoraFin
			$this->TurnoHoraFin->HrefValue = "";

			// TurnoHoraValidaEntradaDesde
			$this->TurnoHoraValidaEntradaDesde->HrefValue = "";

			// TurnoHoraValidaEntradaHasta
			$this->TurnoHoraValidaEntradaHasta->HrefValue = "";

			// TurnoHoraValidaSalidaDesde
			$this->TurnoHoraValidaSalidaDesde->HrefValue = "";

			// TurnoHoraValidaSalidaHasta
			$this->TurnoHoraValidaSalidaHasta->HrefValue = "";

			// TurnoTolMinutosEntrada
			$this->TurnoTolMinutosEntrada->HrefValue = "";

			// TurnoTolMinutosSalida
			$this->TurnoTolMinutosSalida->HrefValue = "";

			// TurnoDiasContados
			$this->TurnoDiasContados->HrefValue = "";

			// TurnoFlexible
			$this->TurnoFlexible->HrefValue = "";
		}
		if ($this->RowType == EW_ROWTYPE_ADD ||
			$this->RowType == EW_ROWTYPE_EDIT ||
			$this->RowType == EW_ROWTYPE_SEARCH) { // Add / Edit / Search row
			$this->SetupFieldTitles();
		}

		// Call Row Rendered event
		if ($this->RowType <> EW_ROWTYPE_AGGREGATEINIT)
			$this->Row_Rendered();
	}

	// Validate form
	function ValidateForm() {
		global $Language, $gsFormError;

		// Initialize form error message
		$gsFormError = "";

		// Check if validation required
		if (!EW_SERVER_VALIDATE)
			return ($gsFormError == "");
		if (!$this->TurnoNombre->FldIsDetailKey && !is_null($this->TurnoNombre->FormValue) && $this->TurnoNombre->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->TurnoNombre->FldCaption());
		}
		if (!$this->TurnoHoraInicio->FldIsDetailKey && !is_null($this->TurnoHoraInicio->FormValue) && $this->TurnoHoraInicio->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->TurnoHoraInicio->FldCaption());
		}
		if (!ew_CheckTime($this->TurnoHoraInicio->FormValue)) {
			ew_AddMessage($gsFormError, $this->TurnoHoraInicio->FldErrMsg());
		}
		if (!$this->TurnoHoraFin->FldIsDetailKey && !is_null($this->TurnoHoraFin->FormValue) && $this->TurnoHoraFin->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->TurnoHoraFin->FldCaption());
		}
		if (!ew_CheckTime($this->TurnoHoraFin->FormValue)) {
			ew_AddMessage($gsFormError, $this->TurnoHoraFin->FldErrMsg());
		}
		if (!$this->TurnoHoraValidaEntradaDesde->FldIsDetailKey && !is_null($this->TurnoHoraValidaEntradaDesde->FormValue) && $this->TurnoHoraValidaEntradaDesde->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->TurnoHoraValidaEntradaDesde->FldCaption());
		}
		if (!ew_CheckTime($this->TurnoHoraValidaEntradaDesde->FormValue)) {
			ew_AddMessage($gsFormError, $this->TurnoHoraValidaEntradaDesde->FldErrMsg());
		}
		if (!$this->TurnoHoraValidaEntradaHasta->FldIsDetailKey && !is_null($this->TurnoHoraValidaEntradaHasta->FormValue) && $this->TurnoHoraValidaEntradaHasta->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->TurnoHoraValidaEntradaHasta->FldCaption());
		}
		if (!ew_CheckTime($this->TurnoHoraValidaEntradaHasta->FormValue)) {
			ew_AddMessage($gsFormError, $this->TurnoHoraValidaEntradaHasta->FldErrMsg());
		}
		if (!$this->TurnoHoraValidaSalidaDesde->FldIsDetailKey && !is_null($this->TurnoHoraValidaSalidaDesde->FormValue) && $this->TurnoHoraValidaSalidaDesde->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->TurnoHoraValidaSalidaDesde->FldCaption());
		}
		if (!ew_CheckTime($this->TurnoHoraValidaSalidaDesde->FormValue)) {
			ew_AddMessage($gsFormError, $this->TurnoHoraValidaSalidaDesde->FldErrMsg());
		}
		if (!$this->TurnoHoraValidaSalidaHasta->FldIsDetailKey && !is_null($this->TurnoHoraValidaSalidaHasta->FormValue) && $this->TurnoHoraValidaSalidaHasta->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->TurnoHoraValidaSalidaHasta->FldCaption());
		}
		if (!ew_CheckTime($this->TurnoHoraValidaSalidaHasta->FormValue)) {
			ew_AddMessage($gsFormError, $this->TurnoHoraValidaSalidaHasta->FldErrMsg());
		}
		if (!$this->TurnoTolMinutosEntrada->FldIsDetailKey && !is_null($this->TurnoTolMinutosEntrada->FormValue) && $this->TurnoTolMinutosEntrada->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->TurnoTolMinutosEntrada->FldCaption());
		}
		if (!ew_CheckInteger($this->TurnoTolMinutosEntrada->FormValue)) {
			ew_AddMessage($gsFormError, $this->TurnoTolMinutosEntrada->FldErrMsg());
		}
		if (!$this->TurnoTolMinutosSalida->FldIsDetailKey && !is_null($this->TurnoTolMinutosSalida->FormValue) && $this->TurnoTolMinutosSalida->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->TurnoTolMinutosSalida->FldCaption());
		}
		if (!ew_CheckInteger($this->TurnoTolMinutosSalida->FormValue)) {
			ew_AddMessage($gsFormError, $this->TurnoTolMinutosSalida->FldErrMsg());
		}
		if (!$this->TurnoDiasContados->FldIsDetailKey && !is_null($this->TurnoDiasContados->FormValue) && $this->TurnoDiasContados->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->TurnoDiasContados->FldCaption());
		}
		if (!ew_CheckNumber($this->TurnoDiasContados->FormValue)) {
			ew_AddMessage($gsFormError, $this->TurnoDiasContados->FldErrMsg());
		}
		if (!$this->TurnoFlexible->FldIsDetailKey && !is_null($this->TurnoFlexible->FormValue) && $this->TurnoFlexible->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->TurnoFlexible->FldCaption());
		}

		// Validate detail grid
		$DetailTblVar = explode(",", $this->getCurrentDetailTable());
		if (in_array("rrhh_turnos_x_persona", $DetailTblVar) && $GLOBALS["rrhh_turnos_x_persona"]->DetailEdit) {
			if (!isset($GLOBALS["rrhh_turnos_x_persona_grid"])) $GLOBALS["rrhh_turnos_x_persona_grid"] = new crrhh_turnos_x_persona_grid(); // get detail page object
			$GLOBALS["rrhh_turnos_x_persona_grid"]->ValidateGridForm();
		}

		// Return validate result
		$ValidateForm = ($gsFormError == "");

		// Call Form_CustomValidate event
		$sFormCustomError = "";
		$ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
		if ($sFormCustomError <> "") {
			ew_AddMessage($gsFormError, $sFormCustomError);
		}
		return $ValidateForm;
	}

	// Update record based on key values
	function EditRow() {
		global $conn, $Security, $Language;
		$sFilter = $this->KeyFilter();
		$this->CurrentFilter = $sFilter;
		$sSql = $this->SQL();
		$conn->raiseErrorFn = 'ew_ErrorFn';
		$rs = $conn->Execute($sSql);
		$conn->raiseErrorFn = '';
		if ($rs === FALSE)
			return FALSE;
		if ($rs->EOF) {
			$EditRow = FALSE; // Update Failed
		} else {

			// Begin transaction
			if ($this->getCurrentDetailTable() <> "")
				$conn->BeginTrans();

			// Save old values
			$rsold = &$rs->fields;
			$this->LoadDbValues($rsold);
			$rsnew = array();

			// TurnoNombre
			$this->TurnoNombre->SetDbValueDef($rsnew, $this->TurnoNombre->CurrentValue, "", $this->TurnoNombre->ReadOnly);

			// TurnoHoraInicio
			$this->TurnoHoraInicio->SetDbValueDef($rsnew, $this->TurnoHoraInicio->CurrentValue, ew_CurrentTime(), $this->TurnoHoraInicio->ReadOnly);

			// TurnoHoraFin
			$this->TurnoHoraFin->SetDbValueDef($rsnew, $this->TurnoHoraFin->CurrentValue, ew_CurrentTime(), $this->TurnoHoraFin->ReadOnly);

			// TurnoHoraValidaEntradaDesde
			$this->TurnoHoraValidaEntradaDesde->SetDbValueDef($rsnew, $this->TurnoHoraValidaEntradaDesde->CurrentValue, ew_CurrentTime(), $this->TurnoHoraValidaEntradaDesde->ReadOnly);

			// TurnoHoraValidaEntradaHasta
			$this->TurnoHoraValidaEntradaHasta->SetDbValueDef($rsnew, $this->TurnoHoraValidaEntradaHasta->CurrentValue, ew_CurrentTime(), $this->TurnoHoraValidaEntradaHasta->ReadOnly);

			// TurnoHoraValidaSalidaDesde
			$this->TurnoHoraValidaSalidaDesde->SetDbValueDef($rsnew, $this->TurnoHoraValidaSalidaDesde->CurrentValue, ew_CurrentTime(), $this->TurnoHoraValidaSalidaDesde->ReadOnly);

			// TurnoHoraValidaSalidaHasta
			$this->TurnoHoraValidaSalidaHasta->SetDbValueDef($rsnew, $this->TurnoHoraValidaSalidaHasta->CurrentValue, ew_CurrentTime(), $this->TurnoHoraValidaSalidaHasta->ReadOnly);

			// TurnoTolMinutosEntrada
			$this->TurnoTolMinutosEntrada->SetDbValueDef($rsnew, $this->TurnoTolMinutosEntrada->CurrentValue, 0, $this->TurnoTolMinutosEntrada->ReadOnly);

			// TurnoTolMinutosSalida
			$this->TurnoTolMinutosSalida->SetDbValueDef($rsnew, $this->TurnoTolMinutosSalida->CurrentValue, 0, $this->TurnoTolMinutosSalida->ReadOnly);

			// TurnoDiasContados
			$this->TurnoDiasContados->SetDbValueDef($rsnew, $this->TurnoDiasContados->CurrentValue, 0, $this->TurnoDiasContados->ReadOnly);

			// TurnoFlexible
			$this->TurnoFlexible->SetDbValueDef($rsnew, $this->TurnoFlexible->CurrentValue, 0, $this->TurnoFlexible->ReadOnly);

			// Call Row Updating event
			$bUpdateRow = $this->Row_Updating($rsold, $rsnew);
			if ($bUpdateRow) {
				$conn->raiseErrorFn = 'ew_ErrorFn';
				if (count($rsnew) > 0)
					$EditRow = $this->Update($rsnew, "", $rsold);
				else
					$EditRow = TRUE; // No field to update
				$conn->raiseErrorFn = '';
				if ($EditRow) {
				}

				// Update detail records
				if ($EditRow) {
					$DetailTblVar = explode(",", $this->getCurrentDetailTable());
					if (in_array("rrhh_turnos_x_persona", $DetailTblVar) && $GLOBALS["rrhh_turnos_x_persona"]->DetailEdit) {
						if (!isset($GLOBALS["rrhh_turnos_x_persona_grid"])) $GLOBALS["rrhh_turnos_x_persona_grid"] = new crrhh_turnos_x_persona_grid(); // Get detail page object
						$EditRow = $GLOBALS["rrhh_turnos_x_persona_grid"]->GridUpdate();
					}
				}

				// Commit/Rollback transaction
				if ($this->getCurrentDetailTable() <> "") {
					if ($EditRow) {
						$conn->CommitTrans(); // Commit transaction
					} else {
						$conn->RollbackTrans(); // Rollback transaction
					}
				}
			} else {
				if ($this->getSuccessMessage() <> "" || $this->getFailureMessage() <> "") {

					// Use the message, do nothing
				} elseif ($this->CancelMessage <> "") {
					$this->setFailureMessage($this->CancelMessage);
					$this->CancelMessage = "";
				} else {
					$this->setFailureMessage($Language->Phrase("UpdateCancelled"));
				}
				$EditRow = FALSE;
			}
		}

		// Call Row_Updated event
		if ($EditRow)
			$this->Row_Updated($rsold, $rsnew);
		$rs->Close();
		return $EditRow;
	}

	// Set up detail parms based on QueryString
	function SetUpDetailParms() {

		// Get the keys for master table
		if (isset($_GET[EW_TABLE_SHOW_DETAIL])) {
			$sDetailTblVar = $_GET[EW_TABLE_SHOW_DETAIL];
			$this->setCurrentDetailTable($sDetailTblVar);
		} else {
			$sDetailTblVar = $this->getCurrentDetailTable();
		}
		if ($sDetailTblVar <> "") {
			$DetailTblVar = explode(",", $sDetailTblVar);
			if (in_array("rrhh_turnos_x_persona", $DetailTblVar)) {
				if (!isset($GLOBALS["rrhh_turnos_x_persona_grid"]))
					$GLOBALS["rrhh_turnos_x_persona_grid"] = new crrhh_turnos_x_persona_grid;
				if ($GLOBALS["rrhh_turnos_x_persona_grid"]->DetailEdit) {
					$GLOBALS["rrhh_turnos_x_persona_grid"]->CurrentMode = "edit";
					$GLOBALS["rrhh_turnos_x_persona_grid"]->CurrentAction = "gridedit";

					// Save current master table to detail table
					$GLOBALS["rrhh_turnos_x_persona_grid"]->setCurrentMasterTable($this->TableVar);
					$GLOBALS["rrhh_turnos_x_persona_grid"]->setStartRecordNumber(1);
					$GLOBALS["rrhh_turnos_x_persona_grid"]->TurnoTurno->FldIsDetailKey = TRUE;
					$GLOBALS["rrhh_turnos_x_persona_grid"]->TurnoTurno->CurrentValue = $this->TurnoId->CurrentValue;
					$GLOBALS["rrhh_turnos_x_persona_grid"]->TurnoTurno->setSessionValue($GLOBALS["rrhh_turnos_x_persona_grid"]->TurnoTurno->CurrentValue);
				}
			}
		}
	}

	// Set up Breadcrumb
	function SetupBreadcrumb() {
		global $Breadcrumb, $Language;
		$Breadcrumb = new cBreadcrumb();
		$Breadcrumb->Add("list", $this->TableVar, "rrhh_turnoslist.php", $this->TableVar, TRUE);
		$PageId = "edit";
		$Breadcrumb->Add("edit", $PageId, ew_CurrentUrl());
	}

	// Page Load event
	function Page_Load() {

		//echo "Page Load";
	}

	// Page Unload event
	function Page_Unload() {

		//echo "Page Unload";
	}

	// Page Redirecting event
	function Page_Redirecting(&$url) {

		// Example:
		//$url = "your URL";

	}

	// Message Showing event
	// $type = ''|'success'|'failure'|'warning'
	function Message_Showing(&$msg, $type) {
		if ($type == 'success') {

			//$msg = "your success message";
		} elseif ($type == 'failure') {

			//$msg = "your failure message";
		} elseif ($type == 'warning') {

			//$msg = "your warning message";
		} else {

			//$msg = "your message";
		}
	}

	// Page Render event
	function Page_Render() {

		//echo "Page Render";
	}

	// Page Data Rendering event
	function Page_DataRendering(&$header) {

		// Example:
		//$header = "your header";

	}

	// Page Data Rendered event
	function Page_DataRendered(&$footer) {

		// Example:
		//$footer = "your footer";

	}

	// Form Custom Validate event
	function Form_CustomValidate(&$CustomError) {

		// Return error message in CustomError
		return TRUE;
	}
}
?>
<?php ew_Header(FALSE) ?>
<?php

// Create page object
if (!isset($rrhh_turnos_edit)) $rrhh_turnos_edit = new crrhh_turnos_edit();

// Page init
$rrhh_turnos_edit->Page_Init();

// Page main
$rrhh_turnos_edit->Page_Main();

// Global Page Rendering event (in userfn*.php)
Page_Rendering();

// Page Rendering event
$rrhh_turnos_edit->Page_Render();
?>
<?php include_once "header.php" ?>
<script type="text/javascript">

// Page object
var rrhh_turnos_edit = new ew_Page("rrhh_turnos_edit");
rrhh_turnos_edit.PageID = "edit"; // Page ID
var EW_PAGE_ID = rrhh_turnos_edit.PageID; // For backward compatibility

// Form object
var frrhh_turnosedit = new ew_Form("frrhh_turnosedit");

// Validate form
frrhh_turnosedit.Validate = function() {
	if (!this.ValidateRequired)
		return true; // Ignore validation
	var $ = jQuery, fobj = this.GetForm(), $fobj = $(fobj);
	this.PostAutoSuggest();
	if ($fobj.find("#a_confirm").val() == "F")
		return true;
	var elm, felm, uelm, addcnt = 0;
	var $k = $fobj.find("#" + this.FormKeyCountName); // Get key_count
	var rowcnt = ($k[0]) ? parseInt($k.val(), 10) : 1;
	var startcnt = (rowcnt == 0) ? 0 : 1; // Check rowcnt == 0 => Inline-Add
	var gridinsert = $fobj.find("#a_list").val() == "gridinsert";
	for (var i = startcnt; i <= rowcnt; i++) {
		var infix = ($k[0]) ? String(i) : "";
		$fobj.data("rowindex", infix);
			elm = this.GetElements("x" + infix + "_TurnoNombre");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($rrhh_turnos->TurnoNombre->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_TurnoHoraInicio");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($rrhh_turnos->TurnoHoraInicio->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_TurnoHoraInicio");
			if (elm && !ew_CheckTime(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($rrhh_turnos->TurnoHoraInicio->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_TurnoHoraFin");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($rrhh_turnos->TurnoHoraFin->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_TurnoHoraFin");
			if (elm && !ew_CheckTime(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($rrhh_turnos->TurnoHoraFin->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_TurnoHoraValidaEntradaDesde");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($rrhh_turnos->TurnoHoraValidaEntradaDesde->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_TurnoHoraValidaEntradaDesde");
			if (elm && !ew_CheckTime(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($rrhh_turnos->TurnoHoraValidaEntradaDesde->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_TurnoHoraValidaEntradaHasta");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($rrhh_turnos->TurnoHoraValidaEntradaHasta->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_TurnoHoraValidaEntradaHasta");
			if (elm && !ew_CheckTime(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($rrhh_turnos->TurnoHoraValidaEntradaHasta->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_TurnoHoraValidaSalidaDesde");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($rrhh_turnos->TurnoHoraValidaSalidaDesde->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_TurnoHoraValidaSalidaDesde");
			if (elm && !ew_CheckTime(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($rrhh_turnos->TurnoHoraValidaSalidaDesde->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_TurnoHoraValidaSalidaHasta");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($rrhh_turnos->TurnoHoraValidaSalidaHasta->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_TurnoHoraValidaSalidaHasta");
			if (elm && !ew_CheckTime(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($rrhh_turnos->TurnoHoraValidaSalidaHasta->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_TurnoTolMinutosEntrada");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($rrhh_turnos->TurnoTolMinutosEntrada->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_TurnoTolMinutosEntrada");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($rrhh_turnos->TurnoTolMinutosEntrada->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_TurnoTolMinutosSalida");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($rrhh_turnos->TurnoTolMinutosSalida->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_TurnoTolMinutosSalida");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($rrhh_turnos->TurnoTolMinutosSalida->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_TurnoDiasContados");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($rrhh_turnos->TurnoDiasContados->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_TurnoDiasContados");
			if (elm && !ew_CheckNumber(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($rrhh_turnos->TurnoDiasContados->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_TurnoFlexible");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($rrhh_turnos->TurnoFlexible->FldCaption()) ?>");

			// Set up row object
			ew_ElementsToRow(fobj);

			// Fire Form_CustomValidate event
			if (!this.Form_CustomValidate(fobj))
				return false;
	}

	// Process detail forms
	var dfs = $fobj.find("input[name='detailpage']").get();
	for (var i = 0; i < dfs.length; i++) {
		var df = dfs[i], val = df.value;
		if (val && ewForms[val])
			if (!ewForms[val].Validate())
				return false;
	}
	return true;
}

// Form_CustomValidate event
frrhh_turnosedit.Form_CustomValidate = 
 function(fobj) { // DO NOT CHANGE THIS LINE!

 	// Your custom validation code here, return false if invalid. 
 	return true;
 }

// Use JavaScript validation or not
<?php if (EW_CLIENT_VALIDATE) { ?>
frrhh_turnosedit.ValidateRequired = true;
<?php } else { ?>
frrhh_turnosedit.ValidateRequired = false; 
<?php } ?>

// Dynamic selection lists
// Form object for search

</script>
<script type="text/javascript">

// Write your client script here, no need to add script tags.
</script>
<?php $Breadcrumb->Render(); ?>
<?php $rrhh_turnos_edit->ShowPageHeader(); ?>
<?php
$rrhh_turnos_edit->ShowMessage();
?>
<form name="frrhh_turnosedit" id="frrhh_turnosedit" class="ewForm form-inline" action="<?php echo ew_CurrentPage() ?>" method="post">
<input type="hidden" name="t" value="rrhh_turnos">
<input type="hidden" name="a_edit" id="a_edit" value="U">
<table class="ewGrid"><tr><td>
<table id="tbl_rrhh_turnosedit" class="table table-bordered table-striped">
<?php if ($rrhh_turnos->TurnoId->Visible) { // TurnoId ?>
	<tr id="r_TurnoId">
		<td><span id="elh_rrhh_turnos_TurnoId"><?php echo $rrhh_turnos->TurnoId->FldCaption() ?></span></td>
		<td<?php echo $rrhh_turnos->TurnoId->CellAttributes() ?>>
<span id="el_rrhh_turnos_TurnoId" class="control-group">
<span<?php echo $rrhh_turnos->TurnoId->ViewAttributes() ?>>
<?php echo $rrhh_turnos->TurnoId->EditValue ?></span>
</span>
<input type="hidden" data-field="x_TurnoId" name="x_TurnoId" id="x_TurnoId" value="<?php echo ew_HtmlEncode($rrhh_turnos->TurnoId->CurrentValue) ?>">
<?php echo $rrhh_turnos->TurnoId->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_turnos->TurnoNombre->Visible) { // TurnoNombre ?>
	<tr id="r_TurnoNombre">
		<td><span id="elh_rrhh_turnos_TurnoNombre"><?php echo $rrhh_turnos->TurnoNombre->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $rrhh_turnos->TurnoNombre->CellAttributes() ?>>
<span id="el_rrhh_turnos_TurnoNombre" class="control-group">
<input type="text" data-field="x_TurnoNombre" name="x_TurnoNombre" id="x_TurnoNombre" size="30" maxlength="50" placeholder="<?php echo ew_HtmlEncode($rrhh_turnos->TurnoNombre->PlaceHolder) ?>" value="<?php echo $rrhh_turnos->TurnoNombre->EditValue ?>"<?php echo $rrhh_turnos->TurnoNombre->EditAttributes() ?>>
</span>
<?php echo $rrhh_turnos->TurnoNombre->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_turnos->TurnoHoraInicio->Visible) { // TurnoHoraInicio ?>
	<tr id="r_TurnoHoraInicio">
		<td><span id="elh_rrhh_turnos_TurnoHoraInicio"><?php echo $rrhh_turnos->TurnoHoraInicio->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $rrhh_turnos->TurnoHoraInicio->CellAttributes() ?>>
<span id="el_rrhh_turnos_TurnoHoraInicio" class="control-group">
<input type="text" data-field="x_TurnoHoraInicio" name="x_TurnoHoraInicio" id="x_TurnoHoraInicio" size="10" placeholder="<?php echo ew_HtmlEncode($rrhh_turnos->TurnoHoraInicio->PlaceHolder) ?>" value="<?php echo $rrhh_turnos->TurnoHoraInicio->EditValue ?>"<?php echo $rrhh_turnos->TurnoHoraInicio->EditAttributes() ?>>
</span>
<?php echo $rrhh_turnos->TurnoHoraInicio->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_turnos->TurnoHoraFin->Visible) { // TurnoHoraFin ?>
	<tr id="r_TurnoHoraFin">
		<td><span id="elh_rrhh_turnos_TurnoHoraFin"><?php echo $rrhh_turnos->TurnoHoraFin->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $rrhh_turnos->TurnoHoraFin->CellAttributes() ?>>
<span id="el_rrhh_turnos_TurnoHoraFin" class="control-group">
<input type="text" data-field="x_TurnoHoraFin" name="x_TurnoHoraFin" id="x_TurnoHoraFin" size="10" placeholder="<?php echo ew_HtmlEncode($rrhh_turnos->TurnoHoraFin->PlaceHolder) ?>" value="<?php echo $rrhh_turnos->TurnoHoraFin->EditValue ?>"<?php echo $rrhh_turnos->TurnoHoraFin->EditAttributes() ?>>
</span>
<?php echo $rrhh_turnos->TurnoHoraFin->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_turnos->TurnoHoraValidaEntradaDesde->Visible) { // TurnoHoraValidaEntradaDesde ?>
	<tr id="r_TurnoHoraValidaEntradaDesde">
		<td><span id="elh_rrhh_turnos_TurnoHoraValidaEntradaDesde"><?php echo $rrhh_turnos->TurnoHoraValidaEntradaDesde->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $rrhh_turnos->TurnoHoraValidaEntradaDesde->CellAttributes() ?>>
<span id="el_rrhh_turnos_TurnoHoraValidaEntradaDesde" class="control-group">
<input type="text" data-field="x_TurnoHoraValidaEntradaDesde" name="x_TurnoHoraValidaEntradaDesde" id="x_TurnoHoraValidaEntradaDesde" size="10" placeholder="<?php echo ew_HtmlEncode($rrhh_turnos->TurnoHoraValidaEntradaDesde->PlaceHolder) ?>" value="<?php echo $rrhh_turnos->TurnoHoraValidaEntradaDesde->EditValue ?>"<?php echo $rrhh_turnos->TurnoHoraValidaEntradaDesde->EditAttributes() ?>>
</span>
<?php echo $rrhh_turnos->TurnoHoraValidaEntradaDesde->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_turnos->TurnoHoraValidaEntradaHasta->Visible) { // TurnoHoraValidaEntradaHasta ?>
	<tr id="r_TurnoHoraValidaEntradaHasta">
		<td><span id="elh_rrhh_turnos_TurnoHoraValidaEntradaHasta"><?php echo $rrhh_turnos->TurnoHoraValidaEntradaHasta->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $rrhh_turnos->TurnoHoraValidaEntradaHasta->CellAttributes() ?>>
<span id="el_rrhh_turnos_TurnoHoraValidaEntradaHasta" class="control-group">
<input type="text" data-field="x_TurnoHoraValidaEntradaHasta" name="x_TurnoHoraValidaEntradaHasta" id="x_TurnoHoraValidaEntradaHasta" size="10" placeholder="<?php echo ew_HtmlEncode($rrhh_turnos->TurnoHoraValidaEntradaHasta->PlaceHolder) ?>" value="<?php echo $rrhh_turnos->TurnoHoraValidaEntradaHasta->EditValue ?>"<?php echo $rrhh_turnos->TurnoHoraValidaEntradaHasta->EditAttributes() ?>>
</span>
<?php echo $rrhh_turnos->TurnoHoraValidaEntradaHasta->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_turnos->TurnoHoraValidaSalidaDesde->Visible) { // TurnoHoraValidaSalidaDesde ?>
	<tr id="r_TurnoHoraValidaSalidaDesde">
		<td><span id="elh_rrhh_turnos_TurnoHoraValidaSalidaDesde"><?php echo $rrhh_turnos->TurnoHoraValidaSalidaDesde->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $rrhh_turnos->TurnoHoraValidaSalidaDesde->CellAttributes() ?>>
<span id="el_rrhh_turnos_TurnoHoraValidaSalidaDesde" class="control-group">
<input type="text" data-field="x_TurnoHoraValidaSalidaDesde" name="x_TurnoHoraValidaSalidaDesde" id="x_TurnoHoraValidaSalidaDesde" size="10" placeholder="<?php echo ew_HtmlEncode($rrhh_turnos->TurnoHoraValidaSalidaDesde->PlaceHolder) ?>" value="<?php echo $rrhh_turnos->TurnoHoraValidaSalidaDesde->EditValue ?>"<?php echo $rrhh_turnos->TurnoHoraValidaSalidaDesde->EditAttributes() ?>>
</span>
<?php echo $rrhh_turnos->TurnoHoraValidaSalidaDesde->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_turnos->TurnoHoraValidaSalidaHasta->Visible) { // TurnoHoraValidaSalidaHasta ?>
	<tr id="r_TurnoHoraValidaSalidaHasta">
		<td><span id="elh_rrhh_turnos_TurnoHoraValidaSalidaHasta"><?php echo $rrhh_turnos->TurnoHoraValidaSalidaHasta->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $rrhh_turnos->TurnoHoraValidaSalidaHasta->CellAttributes() ?>>
<span id="el_rrhh_turnos_TurnoHoraValidaSalidaHasta" class="control-group">
<input type="text" data-field="x_TurnoHoraValidaSalidaHasta" name="x_TurnoHoraValidaSalidaHasta" id="x_TurnoHoraValidaSalidaHasta" size="10" placeholder="<?php echo ew_HtmlEncode($rrhh_turnos->TurnoHoraValidaSalidaHasta->PlaceHolder) ?>" value="<?php echo $rrhh_turnos->TurnoHoraValidaSalidaHasta->EditValue ?>"<?php echo $rrhh_turnos->TurnoHoraValidaSalidaHasta->EditAttributes() ?>>
</span>
<?php echo $rrhh_turnos->TurnoHoraValidaSalidaHasta->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_turnos->TurnoTolMinutosEntrada->Visible) { // TurnoTolMinutosEntrada ?>
	<tr id="r_TurnoTolMinutosEntrada">
		<td><span id="elh_rrhh_turnos_TurnoTolMinutosEntrada"><?php echo $rrhh_turnos->TurnoTolMinutosEntrada->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $rrhh_turnos->TurnoTolMinutosEntrada->CellAttributes() ?>>
<span id="el_rrhh_turnos_TurnoTolMinutosEntrada" class="control-group">
<input type="text" data-field="x_TurnoTolMinutosEntrada" name="x_TurnoTolMinutosEntrada" id="x_TurnoTolMinutosEntrada" size="5" placeholder="<?php echo ew_HtmlEncode($rrhh_turnos->TurnoTolMinutosEntrada->PlaceHolder) ?>" value="<?php echo $rrhh_turnos->TurnoTolMinutosEntrada->EditValue ?>"<?php echo $rrhh_turnos->TurnoTolMinutosEntrada->EditAttributes() ?>>
</span>
<?php echo $rrhh_turnos->TurnoTolMinutosEntrada->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_turnos->TurnoTolMinutosSalida->Visible) { // TurnoTolMinutosSalida ?>
	<tr id="r_TurnoTolMinutosSalida">
		<td><span id="elh_rrhh_turnos_TurnoTolMinutosSalida"><?php echo $rrhh_turnos->TurnoTolMinutosSalida->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $rrhh_turnos->TurnoTolMinutosSalida->CellAttributes() ?>>
<span id="el_rrhh_turnos_TurnoTolMinutosSalida" class="control-group">
<input type="text" data-field="x_TurnoTolMinutosSalida" name="x_TurnoTolMinutosSalida" id="x_TurnoTolMinutosSalida" size="5" placeholder="<?php echo ew_HtmlEncode($rrhh_turnos->TurnoTolMinutosSalida->PlaceHolder) ?>" value="<?php echo $rrhh_turnos->TurnoTolMinutosSalida->EditValue ?>"<?php echo $rrhh_turnos->TurnoTolMinutosSalida->EditAttributes() ?>>
</span>
<?php echo $rrhh_turnos->TurnoTolMinutosSalida->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_turnos->TurnoDiasContados->Visible) { // TurnoDiasContados ?>
	<tr id="r_TurnoDiasContados">
		<td><span id="elh_rrhh_turnos_TurnoDiasContados"><?php echo $rrhh_turnos->TurnoDiasContados->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $rrhh_turnos->TurnoDiasContados->CellAttributes() ?>>
<span id="el_rrhh_turnos_TurnoDiasContados" class="control-group">
<input type="text" data-field="x_TurnoDiasContados" name="x_TurnoDiasContados" id="x_TurnoDiasContados" size="5" placeholder="<?php echo ew_HtmlEncode($rrhh_turnos->TurnoDiasContados->PlaceHolder) ?>" value="<?php echo $rrhh_turnos->TurnoDiasContados->EditValue ?>"<?php echo $rrhh_turnos->TurnoDiasContados->EditAttributes() ?>>
</span>
<?php echo $rrhh_turnos->TurnoDiasContados->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_turnos->TurnoFlexible->Visible) { // TurnoFlexible ?>
	<tr id="r_TurnoFlexible">
		<td><span id="elh_rrhh_turnos_TurnoFlexible"><?php echo $rrhh_turnos->TurnoFlexible->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $rrhh_turnos->TurnoFlexible->CellAttributes() ?>>
<span id="el_rrhh_turnos_TurnoFlexible" class="control-group">
<select data-field="x_TurnoFlexible" id="x_TurnoFlexible" name="x_TurnoFlexible"<?php echo $rrhh_turnos->TurnoFlexible->EditAttributes() ?>>
<?php
if (is_array($rrhh_turnos->TurnoFlexible->EditValue)) {
	$arwrk = $rrhh_turnos->TurnoFlexible->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($rrhh_turnos->TurnoFlexible->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
</span>
<?php echo $rrhh_turnos->TurnoFlexible->CustomMsg ?></td>
	</tr>
<?php } ?>
</table>
</td></tr></table>
<?php
	if (in_array("rrhh_turnos_x_persona", explode(",", $rrhh_turnos->getCurrentDetailTable())) && $rrhh_turnos_x_persona->DetailEdit) {
?>
<?php include_once "rrhh_turnos_x_personagrid.php" ?>
<?php } ?>
<button class="btn btn-primary ewButton" name="btnAction" id="btnAction" type="submit"><?php echo $Language->Phrase("EditBtn") ?></button>
</form>
<script type="text/javascript">
frrhh_turnosedit.Init();
<?php if (EW_MOBILE_REFLOW && ew_IsMobile()) { ?>
ew_Reflow();
<?php } ?>
</script>
<?php
$rrhh_turnos_edit->ShowPageFooter();
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
?>
<script type="text/javascript">

// Write your table-specific startup script here
// document.write("page loaded");

</script>
<?php include_once "footer.php" ?>
<?php
$rrhh_turnos_edit->Page_Terminate();
?>
